#include<bits/stdc++.h>
using namespace std;
int n,r[100005],ans;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;i++)    scanf("%d",&r[i]);
    sort(r,r+n);
    for(int i=0,j=n-1;j>i;i++,j--){
        if(r[j]>r[i])   ans++;
        else    ans+=2;
    }
    if(n%2==1){
        int tmp=n/2+1;
        if(r[tmp]==r[tmp-1])    ans++;
    }
    printf("%d",ans);
    return 0;
}
